#!/usr/bin/env bash

echo "settings.all_compile = false" >mise.toml
echo 'settings.disable_backends = ["rust", "java"]' >>mise.toml

assert_contains "mise settings" 'all_compile       false            ~/workdir/mise.toml
disable_backends  ["rust", "java"] ~/workdir/mise.toml'

assert_contains "mise settings --json" '{
  "all_compile": false,
  "disable_backends": [
    "rust",
    "java"
  ]
}'

assert_contains "mise settings --toml" 'all_compile = false
disable_backends = ["rust", "java"]'

assert_contains "mise settings --json-extended" "{
  \"all_compile\": {
    \"value\": false,
    \"type\": \"boolean\",
    \"description\": \"do not use precompiled binaries for any tool\",
    \"source\": \"$HOME/workdir/mise.toml\"
  },
  \"disable_backends\": {
    \"value\": [
      \"rust\",
      \"java\"
    ],
    \"type\": \"array\",
    \"description\": \"Backends to disable such as \`asdf\` or \`pipx\`\",
    \"source\": \"$HOME/workdir/mise.toml\"
  }
}"

assert_contains "mise settings ls -T" "all_compile = false"
echo "settings.python.venv_auto_create = false" >>mise.toml
assert_contains "mise settings ls python" "venv_auto_create  false"
